﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using TSharp.Core.Util;

namespace TSharp.Core.Env
{
    /// <summary>
    /// 
    /// </summary>
    /// <author>
    /// tangjingbo
    /// </author>
    /// <remarks>
    /// tangj15 at 2012-5-4 13:14
    /// </remarks>
    public class TSharpGlobal
    {
        private static readonly bool isRouteDebuggerEnable;
        private static Encoding _encoding = Encoding.UTF8;
        private static bool _isDebuggerEnable; 


        /// <summary>
        /// Initializes the <see cref="TSharpGlobal"/> class.
        /// </summary>
        static TSharpGlobal()
        {
            _isDebuggerEnable = ConfigurationManager.AppSettings["Debugger:Enabled"].ToBoolean();
            isRouteDebuggerEnable = _isDebuggerEnable && ConfigurationManager.AppSettings["RouteDebugger:Enabled"].ToBoolean();
        }
         

        /// <summary>
        /// Gets or sets a value indicating whether this instance is debugger enable.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is debugger enable; otherwise, <c>false</c>.
        /// </value>
        public static bool IsDebuggerEnable
        {
            get { return TSharpGlobal._isDebuggerEnable; }
            set { TSharpGlobal._isDebuggerEnable = value; }
        }

        /// <summary>
        /// Gets a value indicating whether this instance is route debugger enable.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is route debugger enable; otherwise, <c>false</c>.
        /// </value>
        public static bool IsRouteDebuggerEnable
        {
            get
            {
                return isRouteDebuggerEnable;
            }
        }

        /// <summary>
        /// Gets or sets the encoding.
        /// </summary>
        /// <value>
        /// The encoding.
        /// </value>
        public static Encoding Encoding
        {
            get { return TSharpGlobal._encoding; }
            set { TSharpGlobal._encoding = value; }
        }
    }
}
